import request from '@/utils/request'

export const liveGetSerachService = (query) => {
  return request.get(`/live/api/public/search?query=${query}`)
}

export const livePostStartService = (formModel) => {
  const formData = new FormData();
  for (const key in formModel) {
    formData.set(key, formModel[key]);
  }

  return request.post('/live/api/me/start', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

export const livePostProductService = (formModel) => {
  const formData = new FormData();
  for (const key in formModel) {
    formData.set(key, formModel[key]);
  }

  return request.post('/live/api/me/product', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

export const liveGetProductService = (id) => {
  return request.get(`/live/api/me/product/${id}`);
}

export const liveGetRoomProductService = (roomId) => {
  return request.get(`/live/api/me/product/room/${roomId}`);
}